home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / graphics / library / wgt51_r2.zip / WGT5 / EXAMPLES / WGT16.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-03  |  2.5 KB  |  72 lines

  1. /*
  2. ==============================================================================
  3.                       WordUp Graphics Toolkit Version 5.0                     
  4.                              Demonstration Program 16                         
  5.                                                                               
  6.  This program shows how to use wcopyscreen.                                   
  7.                                                                               
  8.  *** PROJECT ***                                                             
  9.  This program requires the file WGT5_WC.LIB to be linked.                    
  10.                                                                               
  11.  *** DATA FILES ***                                                          
  12.  NONE                                                                        
  13.                                                            WATCOM C++ VERSION 
  14. ==============================================================================
  15. */
  16.  
  17. #include <wgt5.h>
  18.  
  19.  
  20. void main(void)
  21. {
  22.   short x,y, tempx, tempy;
  23.   short oldmode;
  24.   block screen1;
  25.  
  26.   printf ("WGT Example #16\n\n");
  27.   printf ("This program demonstrates virtual screen buffers.\n");
  28.   printf ("It will copy data from a virtual screen to the current mouse location\n");
  29.   printf ("on the visual screen. Press a key to end the demo at any time.\n");
  30.   printf ("\n\nPress any key to continue.\n");
  31.   getch ();
  32.  
  33.   if ( !vgadetected () )
  34.   {
  35.     printf("Error - VGA card required for any WGT program.\n");
  36.     exit (0);
  37.   }
  38.   oldmode = wgetmode ();
  39.   vga256 ();
  40.  
  41.   screen1 = wnewblock (0, 0, 319, 199);
  42.  
  43.   wsetscreen (screen1);          /* sets to screen1 */
  44.   for (y = 0; y < 200; y++)
  45.   {
  46.     wsetcolor (y);
  47.     wfline (0, 0, 319, y);          /* draw something on another screen */
  48.     wfline (319, 199, 0, y);
  49.   }
  50.  
  51.   minit ();
  52.   moff ();
  53.   wnormscreen ();                /* make the putblock go onto the default screen */
  54.  
  55.   do {
  56.     tempx = mouse.mx;
  57.     tempy = mouse.my;
  58.     wcopyscreen (tempx, tempy, tempx+19, tempy+19, screen1, tempx, tempy, NULL);
  59.     /* this means copy a square 20*20 from screen1 to the same spot
  60.        on the default screen.  Move the mouse around and watch the black
  61.        wipe away as screen1 copies over. */
  62.  
  63.     /* NULL means the default screen. */
  64.   } while (!kbhit ());
  65.   mdeinit ();                   /* Deinitialize the mouse handler */
  66.  
  67.   getch ();              /* wasn't that fun! */
  68.  
  69.   wfreeblock (screen1);
  70.   wsetmode (oldmode);
  71. }
  72.